package stool.juc.collection;

import java.util.List;
import java.util.UUID;
import java.util.Vector;

/**
 * 保证了数据一致性，加锁没有保证并发性
 * @author Felix YF Dong
 * @Description Vector
 * @Date 2023/2/17
 */
public class ConcurrentCollection2 {

    public static void main(String[] args) {
        List<String> list = new Vector<>();
        for (int i = 0; i < 50; i++) {
            new Thread(() -> {
                list.add(UUID.randomUUID().toString().substring(0, 8));
                System.out.println(list);
            }, String.valueOf(i)).start();
        }
    }
}
